﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;

namespace zielonka.co.uk.extensions.system
{
    //Description: Create a new Image from a byte array
    /*
        byte[] imageBytes = GetImageBytesFromDB();
        Image myImage = imageBytes.ToImage();
     */

    public static partial class ByteExtensions
    {
        public static Image ToImage(this byte[] bytes)
        {
            if (bytes == null)
                throw new ArgumentNullException("bytes");

            return Image.FromStream(new MemoryStream(bytes));
        }

    }
}
